<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let arr = ["广东省","广西","湖北省","湖南省","北京","吉林省"]
    let res = arr.map((item)=>{
        let str = ''
        let num = item.indexOf('省')
        if(num != -1){
            str = item.substr(0,num)
        }else{
            str = item
        }

        return str
    })
    console.log(res)
</script>
</body>
</html>
